Skip to content

Conversation

wassup05
Copy link
Contributor

@wassup05 wassup05 commented Aug 11, 2025

User facing functions added are:

  • is_abs(path): returns a logical indicating if the path is absolute.
  • abs_path(path [, err]): returns the absolutized version of the path.

is_abs does pure string manipulation checking if

  • on POSIX systems, path starts with /
  • on Windows systems it is either an UNC path or starts with a drive letter like C:\

abs_path performs a syscall to get the current working directory and then joins it to the path, returning the joined path

Prior Art

os.path.abspath (Python)
os.path.isabs (Python)

Copy link
Member

@sebastian-mutz sebastian-mutz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @wassup05!
I'm wondering if is_abs_path may be better to use. While "path" is the first thing many will think of from context, it is entirely implied. Even in the use statement stdlib_system, only: is_abs, it's not visible (c.f. Python's os.path.isabs).

@wassup05
Copy link
Contributor Author

I had that in mind too @sebastian-mutz, and I have changed it now.

Copy link
Member

@sebastian-mutz sebastian-mutz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the recent change, @wassup05. Many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants